package com.axonactive;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Stateless
public class BookDao {
	@PersistenceContext
	private EntityManager em;
	
	public List<Book> getBooks(){
		List<Book> listBook = em.createQuery("select b from Book b",Book.class).getResultList();
		return listBook;
	}
	
	public void addBook(Book book){
		em.persist(book);
	}
}
